package org.example;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;
import java.util.Set;

public class JdsUtils {

    private static String IP = "192.168.1.195";

    public static JedisCluster jedisCluster;

    static {
        JedisPoolConfig config = new JedisPoolConfig();
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
        jedisClusterNode.add(new HostAndPort(IP, 7001));
        jedisClusterNode.add(new HostAndPort(IP, 7002));
        jedisClusterNode.add(new HostAndPort(IP, 7003));
        jedisClusterNode.add(new HostAndPort(IP, 7004));
        jedisClusterNode.add(new HostAndPort(IP, 7005));
        jedisClusterNode.add(new HostAndPort(IP, 7006));
        jedisClusterNode.add(new HostAndPort(IP, 7007));
        jedisClusterNode.add(new HostAndPort(IP, 7008));

        jedisCluster = new JedisCluster(jedisClusterNode, config);
    }
}
